package com.njust.mapper;

import com.njust.dataobject.TrainInfo;
import com.njust.dataobject.TrainInfoExample;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

public interface TrainInfoMapper {
    int countByExample(TrainInfoExample example);

    int deleteByExample(TrainInfoExample example);

    int deleteByPrimaryKey(Long trainOnlyid);

    int insert(TrainInfo record);

    int insertSelective(TrainInfo record);

    List<TrainInfo> selectByExample(TrainInfoExample example);

    TrainInfo selectByPrimaryKey(Long trainOnlyid);

    int updateByExampleSelective(@Param("record") TrainInfo record, @Param("example") TrainInfoExample example);

    int updateByExample(@Param("record") TrainInfo record, @Param("example") TrainInfoExample example);

    int updateByPrimaryKeySelective(TrainInfo record);

    int updateByPrimaryKey(TrainInfo record);

    TrainInfo findTrainInfoByLastTrainId();

    List<Long> findTrainOnlyIdBytrainIdAndtrainDate(@Param("trainId") String trainId
            ,@Param("firstTime")Date firstTime,@Param("lastTime")Date lastTime);

    List<Long> findLastSixByTrainDateAndTrainId(@Param("trainId")String trainId,@Param("firstTime")Date
            firstTime,@Param("lastTime")Date lastTime);

    //先对状态进行升序 再对日期进行降序排列
    List<TrainInfo> findByStateandTrainDate(@Param("firstTime")Date firstTime,@Param("lastTime")Date lastTime);

    List<Long> findTrainOnlyIdBytrainIdInAndtrainDate(@Param("trainIds") List<String> trainIds
            ,@Param("firstTime")Date firstTime,@Param("lastTime")Date lastTime);

}